﻿@model ShivamEMR.Web.Areas.Patient.ViewModels.AdmissionViewModel
@{
    ViewBag.Title = "New";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
    $(document).ready(function () {

        $("#admissiontype").change(function () {           
            var path = "/Admission/GetEmployeesToAssign/" + $(this).val();
            $.get(path, function (data) {
                $("#assignedData").hide("fast").html(data).show("slow");
            });
        });

    });

</script>
<h3>
    New Admission</h3>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm(FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Admission</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Admission.AdmissionDateAndTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Admission.AdmissionDateAndTime)
            @Html.ValidationMessageFor(model => model.Admission.AdmissionDateAndTime)
        </div>
        <div class="editor-label">
            AdmissionType
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Admission.AdmissionTypeID, ((IEnumerable<ShivamEMR.Model.Domain.PatientDomain.AdmissionType>)ViewBag.PossibleAdmissionTypes).Select(option => new SelectListItem
    {
        Text = Html.DisplayTextFor(_ => option.Type).ToString(),
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.Admission.AdmissionTypeID)
    }), "Choose...", new { @id = "admissiontype" })
            @Html.ValidationMessageFor(model => model.Admission.AdmissionTypeID)
        </div>
        <div class="editor-label">
            ReferredBy
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Admission.ReferredByID, ((IEnumerable<ShivamEMR.Model.Domain.DoctorsDomain.Doctor>)ViewBag.PossibleReferredBies).Select(option => new SelectListItem
{
    Text = (option == null ? "None" : option.FullName),
    Value = option.ID.ToString(),
    Selected = (Model != null) && (option.ID == Model.Admission.ReferredByID)
}), "Choose...")
            @Html.ValidationMessageFor(model => model.Admission.ReferredByID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Admission.ReferrerNotes)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Admission.ReferrerNotes)
            @Html.ValidationMessageFor(model => model.Admission.ReferrerNotes)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Admission.Notes)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Admission.Notes)
            @Html.ValidationMessageFor(model => model.Admission.Notes)
        </div>
        <div class="editor-label">
            Assigned To
        </div>
        <div class="editor-field" id="assignedData">
            @Html.DropDownListFor(model => model.AssignedToID, ((IEnumerable<ShivamEMR.Model.Domain.CompanyDomain.Employee>)ViewBag.PossibleEmployees).Select(option => new SelectListItem
{
    Text = (option == null ? "None" : option.FullName),
    Value = option.ID.ToString(),
    Selected = (Model != null) && (option.ID == Model.AssignedToID)
}), "Choose...", new { @multiple = "multiple" })
            @Html.ValidationMessageFor(model => model.AssignedToID)
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to Dashboard", "PDashboard", "Patient")
</div>
